package com.drug.wms.service;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class GenerateSequence {

    private static IBusSequenceConfService staticBusSeq;


    @Autowired
    IBusSequenceConfService busSequenceConfService;


    @PostConstruct
    public void init() {
        setStaticBusSeq(busSequenceConfService);
    }

    /**
     * 生成序列号
     *
     * @param code
     * @return
     */
    public static String genSeqNo(String code) {
        return staticBusSeq.genSeqByCode(code);
    }

    /**
     * 生成序列号
     *
     * @param code
     * @return
     */
    public static String genSeqNo(String code, int length) {
        return staticBusSeq.genSeqByCode(code, length);
    }


    private void setStaticBusSeq(IBusSequenceConfService busSequenceConfService) {
        staticBusSeq = busSequenceConfService;
    }


}
